<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 短路赋值



        // 或运算见真即短路
        var a = 1 || 2;
        console.log(a);   // 1

        var b = 0 || 2;
        console.log(b);  // 2

        var c = 3 > 4 || 4 > 2;
        console.log(c);  // true




        // 与运算见假即短路
        var d = 1 && 2;
        console.log(d);    // 2

        var e = 0 && 2;
        console.log(e);   // 0

    </script>

</body>

</html>